/*
 * broadcaster.h
 *
 *  Created on: Aug 28, 2010
 *      Author: kevin
 */

#ifndef BROADCASTER_H_
#define BROADCASTER_H_
#include <string>
using std::string;

#include <Poco/Timer.h>
using Poco::Timer;
using Poco::TimerCallback;

#include <Poco/Net/MulticastSocket.h>
#include <Poco/Net/SocketAddress.h>
using Poco::Net::MulticastSocket;
using Poco::Net::SocketAddress;

class Broadcaster : public Poco::Runnable
{
	public:
		Broadcaster( SocketAddress address, string name );
		virtual ~Broadcaster();
		void run();
		void setName( string name );
		void stop();

	private:
		void onTimer(Timer &timer);
		void send();
		MulticastSocket* _sock;
		string _name;
		bool _stopping;
};

#endif /* BROADCASTER_H_ */
